package com.whfc.mach.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.whfc.mach.constant.MachMeasurement;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;

import java.io.Serializable;
import java.time.Instant;
import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @Description: 设备硬件数据DTO
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/7/20 14:13
 */
@Data
@Measurement(name = MachMeasurement.MEASUREMENT, database = MachMeasurement.DATABASE, retentionPolicy = MachMeasurement.RETENTION_POLICY, timeUnit = TimeUnit.SECONDS)
public class AppMachDataLogDTO extends WorkStateDTO implements Serializable {

    /**
     * 硬件时间
     */
    private Date time;

    /**
     * 服务器时间
     */
    private Date createTime;

    /**
     * 硬件时间
     */
    @Column(name = "time")
    private Instant deviceTime;

    /**
     * 服务器时间
     */
    @Column(name = "serverTime")
    private Long serverTime;

    @Column(name = "machId", tag = true)
    private String machId;

    @Column(name = "deviceId", tag = true)
    private String deviceId;

    @Column(name = "workState")
    private Integer workState;

    @Column(name = "netState")
    private Integer netState;

    @Column(name = "lngFlag")
    private String lngFlag;

    @Column(name = "latFlag")
    private String latFlag;

    @Column(name = "lng")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Double lng;

    @Column(name = "lat")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Double lat;

    @Column(name = "lngWgs84")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Double lngWgs84;

    @Column(name = "latWgs84")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Double latWgs84;

    @Column(name = "location")
    private String location;

    @Column(name = "rotationX")
    private Double rotationX;

    @Column(name = "rotationY")
    private Double rotationY;

    @Column(name = "rotationZ")
    private Double rotationZ;

    @Column(name = "batterState")
    private Integer batteryState;

    @Column(name = "batterPower")
    private Integer batteryPower;

    @Column(name = "deviceTemp")
    private Double deviceTemp;

    @Column(name = "pressure")
    private Double pressure;

    @Column(name = "oilPos")
    private Integer oilPos;

    @Column(name = "oilTemp")
    private Double oilTemp;

    @Column(name = "oilState")
    private Integer oilState;

    @Column(name = "oilPower")
    private Integer oilPower;

    @Column(name = "masterVer")
    private String masterVer;

    @Column(name = "slaveVer")
    private String slaveVer;

    @Column(name = "speed")
    private Double speed;

    @Column(name = "elevation")
    private Double elevation;
}
